//
//  SAFeedbackActiveRankingController.m
//  SunOn
//
//  Created by mc on 2017/5/4.
//  Copyright © 2017年 NeoZhang. All rights reserved.
//  活跃度排行

#import "SAFeedbackActiveRankingController.h"
#import "SAFeedbackActiveRankingChildController.h"
@interface SAFeedbackActiveRankingController ()
@property (nonatomic, strong) NSArray *titleData;
@end

@implementation SAFeedbackActiveRankingController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark 初始化代码
- (instancetype)init {
    if (self = [super init]) {
        self.titleSizeNormal = 15;
        self.titleSizeSelected = 15;
        self.menuViewStyle = WMMenuViewStyleLine;
        self.pageAnimatable = YES;
        self.titleColorSelected = [UIColor colorWithHexString:@"#0084fd"];
        self.titleColorNormal = [UIColor blackColor];
        self.menuItemWidth = SASCREEN_WIDTH / 3;
        self.progressColor = [UIColor colorWithHexString:@"#0084fd"];
        self.menuHeight = 40;
        self.menuBGColor = [UIColor whiteColor];
        self.progressWidth = SASCREEN_WIDTH / 3 - 60;
    }
    return self;
    
}

#pragma mark - view cycle
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    UIButton *back = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [back setBackgroundImage:SAImageNamed(@"ljiantou") forState:(UIControlStateNormal)];
    back.frame = CGRectMake(0, 0, 10, 19);
    [back addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
    UIBarButtonItem *leftitem = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = leftitem;
    
    UIButton *messageInformation = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [messageInformation setBackgroundImage:SAImageNamed(@"NaviBar-xiaoxi1") forState:(UIControlStateNormal)];
    messageInformation.frame = CGRectMake(0, 0, 25, 25);
    [messageInformation addTarget:self action:@selector(moreMessageInformation:) forControlEvents:(UIControlEventTouchUpInside)];
    UIBarButtonItem *rightitem = [[UIBarButtonItem alloc] initWithCustomView:messageInformation];
    self.navigationItem.rightBarButtonItem = rightitem;
}
#pragma mark - custome method
//更多消息
- (void)moreMessageInformation:(UIButton *)sender {
    [sender setBackgroundImage:SAImageNamed(@"NaviBar-xiaoxi2") forState:(UIControlStateNormal)];
}
- (void)backAction{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - Datasource & Delegate
- (NSInteger)numbersOfChildControllersInPageController:(WMPageController *)pageController {
    return self.titleData.count;
}
- (NSString *)pageController:(WMPageController *)pageController titleAtIndex:(NSInteger)index {
    return self.titleData[index];
}
- (UIViewController *)pageController:(WMPageController *)pageController viewControllerAtIndex:(NSInteger)index {
    SAFeedbackActiveRankingChildController *vcClass = [[SAFeedbackActiveRankingChildController alloc] init];
    vcClass.type = index;
    return vcClass;
}

#pragma mark - setter&getter
- (NSArray *)titleData {
    if (!_titleData) {
        _titleData = @[@"部门",@"个人"];
    }
    return _titleData;
}

@end
